#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
#include <QList>
#include <QTimer>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QAction>
#include "tcpforward.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_newConnection();
    void on_forwardDestroyed(TcpForward *forward);
    void on_startRadioButton_toggled(bool checked);
    void on_localIpComboBox_currentTextChanged(const QString &arg1);
    void on_upload(int num);
    void on_download(int num);
    void on_statisticsTimerDone();
    void on_trayIconActived(QSystemTrayIcon::ActivationReason reason);

protected:
    void hideEvent(QHideEvent *event);

private:
    Ui::MainWindow *ui;
    QTcpServer *server;
    QList<TcpForward *> forwards;
    QTimer *statisticsTimer;
    QSystemTrayIcon *trayIcon;
    QMenu *trayMenu;
    QAction *quitAction;

    int uploadCount = 0;
    int downloadCount = 0;
};

#endif // MAINWINDOW_H
